package jhsys.mc.broadcast;

import java.util.Hashtable;

import android.content.Intent;

import jhsys.mc.service.ProcessResult;

/**
 * @author pengxj
 * @email pengxj@jhsys.cn
 * @created 2011-7-13
 */

public class DefaultIntentFilter {

	public static final int ACTION_ID_NONE = 0x0;
	public static final int ACTION_ID_SMARTHOME_STATE = 0x01;
	public static final int ACTION_ID_FQDIALOG_PROCESS = 0x02;
	public static final int ACTION_ID_WIFISTATE =0x03;
	public static final int ACTION_ID_PAGESTATE =0x04;
	public static final int ACTION_ID_FQSTATE =0x05;
	
	public static final String ACTION_SMARTHOME_STATE = ProcessResult.SMARTHOME_STATE;
	public static final String ACTION_FQDIALOG_PROCESS = ProcessResult.FQDialog_process;
	public static final String ACTION_WIFISTATE = ProcessResult.SMARTHOME_SETTING_WIFI_STATE;
	public static final String ACTION_PAGESTATE = ProcessResult.PAGE_STATUE;
	public static final String ACTION_FQSTATE = ProcessResult.FQ_STATUE;
	public static final Hashtable<String, Integer> fActionTable;
	static {
		fActionTable = new Hashtable<String, Integer>(16);
		fActionTable.put(ACTION_SMARTHOME_STATE, ACTION_ID_SMARTHOME_STATE);
		fActionTable.put(ACTION_FQDIALOG_PROCESS, ACTION_ID_FQDIALOG_PROCESS);
		fActionTable.put(ACTION_WIFISTATE, ACTION_ID_WIFISTATE);
		fActionTable.put(ACTION_PAGESTATE , ACTION_ID_PAGESTATE);
		fActionTable.put(ACTION_FQSTATE , ACTION_ID_FQSTATE);
	}
	
	/**
	 * @param action
	 * @return action id
	 */
	public static int getActionID(String action) {
		if(action == null) {
			return ACTION_ID_NONE;
		}
		Integer actionID = fActionTable.get(action);
		if(actionID == null) {
			return ACTION_ID_NONE;
		}
		return actionID;
	}
}
